<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>registered</title>
    <script src="../modules/js/common.js"></script>
</head>
<body>
<div class="contariner" >
    用户名:<input id="username"><br>
    密&nbsp;码:<input id="password"><br>
    <button class="btn-info" id="registered">注册</button>
</div>

<script>
    $("#registered").click( function (){

        let username=$("#username").val();
        let password=$("#password").val();
        if(username==""||password==""){
            alert("账号或密码不能为空");
            return;
        }
        let url=`http://localhost:8080/user/`
        let data={username:username,password:password}
        $.ajax({
            method:"post",
            url:url,data:JSON.stringify(data),
            contentType:"application/json",
            success(result) {
                    alert(result.message);
            }
        })
    })



</script>
</body>
</html>